<?php
/**
 * Created by JetBrains PhpStorm.
 * User: CAIXUDONG
 * Date: 11-6-16
 * Time: 下午4:06
 */
 
include '../bootstrap.php';

$_user = Model::getInstance('user');
$user_info = $_user->needLogin();

$role_id = $_input->post('role_id');
$role_name = $_input->post('role_name');

if(!$role_id || !$role_name){
    $data = array(
        "statusCode"=>"300",
        "message"=>"参数错误",
    );
    echo Response::JSON($data);
    exit;
}

$ret = Model::getInstance('role')->updateRole($role_id,$role_name);
if($ret){
    
    $data = array(
        "statusCode"=>"200",
        "message"=>"修改成功",
        "navTabId"=>"role",
    );
    echo Response::JSON($data);
}else{

    $data = array(
        "statusCode"=>"300",
        "message"=>"修改失败",
    );
    echo Response::JSON($data);
}